*!version June 2024
/*Transforms csco15 (Chinese Classification of Occupations) 5 digit codes into csei. 

Data:
cgss2010-2018, css2011-2019, clds2016

Reference:
Freda Yanrong WANG, Raymond WONG & Yujia HOU. (2024) Research on the Occupational Structure Changes in Chinese Society. Bejing:People's Publishing House. ISBN:978-7-01-026546-9.

*/

program define csko15csei10
	version 17
	syntax newvarname, csko(varname numeric)
    quietly gen `varlist'=`csko'
	quietly replace `varlist'=	59.72 	 if (`csko' == 	10000	)				
	quietly replace `varlist'=	67.89 	 if (`csko' >= 	10100	 & `csko' <	10200	)		
	quietly replace `varlist'=	90.19 	 if (`csko' >= 	10200	 & `csko' <	10300	)		
	quietly replace `varlist'=	81.50 	 if (`csko' >= 	10300	 & `csko' <	10400	)		
	quietly replace `varlist'=	62.98 	 if (`csko' >= 	10400	 & `csko' <	10500		 & `csko' <	10600
	quietly replace `varlist'=	61.91 	 if (`csko' >= 	10500	 & `csko' <	10600	)		
	quietly replace `varlist'=	57.04 	 if (`csko' == 	10600	)				
	quietly replace `varlist'=	56.46 	 if (`csko' == 	10601	)				
	quietly replace `varlist'=	79.60 	 if (`csko' == 	10602	)				
	quietly replace `varlist'=	68.63 	 if (`csko' == 	20000	 | `csko' ==	29900	)		
	quietly replace `varlist'=	75.64 	 if (`csko' >= 	20100	 & `csko' <	20200	)		
	quietly replace `varlist'=	64.62 	 if (`csko' == 	20200	 | `csko' ==	20299	)		
	quietly replace `varlist'=	71.49 	 if (`csko' >= 	20201	 & `csko' <	20205	)		
	quietly replace `varlist'=	65.06 	 if (`csko' >= 	20205	 & `csko' <	20207	)		
	quietly replace `varlist'=	70.07 	 if (`csko' >= 	20207	 & `csko' <	20209	)		
	quietly replace `varlist'=	65.49 	 if (`csko' >= 	20209	 & `csko' <	20211	)		
	quietly replace `varlist'=	64.94 	 if (`csko' >= 	20211	 & `csko' <	20215	)		
	quietly replace `varlist'=	68.34 	 if (`csko' >= 	20215	 & `csko' <	20228	)		
	quietly replace `varlist'=	59.18 	 if (`csko' >= 	20228	 & `csko' <	20299	)		
	quietly replace `varlist'=	65.34 	 if (`csko' >= 	20300	 & `csko' <	20400	)		
	quietly replace `varlist'=	66.14 	 if (`csko' >= 	20400	 & `csko' <	20500	)		
	quietly replace `varlist'=	64.91 	 if (`csko' == 	20500	 | `csko' ==	20599	)		
	quietly replace `varlist'=	69.37 	 if (`csko' >= 	20501	 & `csko' <	20506	)		
	quietly replace `varlist'=	64.89 	 if (`csko' >= 	20506	 & `csko' <	20508	)		
	quietly replace `varlist'=	60.40 	 if (`csko' >= 	20508	 & `csko' <	20599	)		
	quietly replace `varlist'=	66.65 	 if (`csko' == 	20600	 | `csko' ==	20699	)		
	quietly replace `varlist'=	65.95 	 if (`csko' == 	20601	)				
	quietly replace `varlist'=	67.12 	 if (`csko' == 	20602	)				
	quietly replace `varlist'=	66.64 	 if (`csko' >= 	20603	 & `csko' <	20608	)		
	quietly replace `varlist'=	68.49 	 if (`csko' >= 	20608	 & `csko' <	20699	)		
	quietly replace `varlist'=	69.58 	 if (`csko' >= 	20700	 & `csko' <	20800	)		
	quietly replace `varlist'=	74.04 	 if (`csko' == 	20800	 | `csko' ==	20899	)		
	quietly replace `varlist'=	100.53 	 if (`csko' == 	20801	)				
	quietly replace `varlist'=	76.26 	 if (`csko' >= 	20802	 & `csko' <	20804	)		
	quietly replace `varlist'=	48.48 	 if (`csko' >= 	20804	 & `csko' <	20899	)		
	quietly replace `varlist'=	58.69 	 if (`csko' == 	20900	 | `csko' ==	20999	)		
	quietly replace `varlist'=	58.06 	 if (`csko' >= 	20901	 & `csko' <	20906	)		
	quietly replace `varlist'=	59.28 	 if (`csko' >= 	20906	 & `csko' <	20999	)		
	quietly replace `varlist'=	65.11 	 if (`csko' >= 	21000	 & `csko' <	29900	)		
	quietly replace `varlist'=	61.15 	 if (`csko' == 	30000	 | `csko' ==	39900	)		
	quietly replace `varlist'=	63.52 	 if (`csko' == 	30100	 | `csko' ==	30199	)		
	quietly replace `varlist'=	65.81 	 if (`csko' == 	30101	)				
	quietly replace `varlist'=	61.94 	 if (`csko' >= 	30102	 & `csko' <	30199	)		
	quietly replace `varlist'=	53.12 	 if (`csko' == 	30200	 | `csko' ==	30299	)		
	quietly replace `varlist'=	68.03 	 if (`csko' == 	30201	)				
	quietly replace `varlist'=	47.45 	 if (`csko' >= 	30202	 & `csko' <	30299	)		
	quietly replace `varlist'=	43.95 	 if (`csko' == 	40000	 | `csko' ==	49900	)		
	quietly replace `varlist'=	42.65 	 if (`csko' == 	40100	 | `csko' ==	40199	)		
	quietly replace `varlist'=	51.06 	 if (`csko' == 	40101	)				
	quietly replace `varlist'=	42.54 	 if (`csko' == 	40102	)				
	quietly replace `varlist'=	47.20 	 if (`csko' == 	40103	)				
	quietly replace `varlist'=	38.68 	 if (`csko' >= 	40104	 & `csko' <	40199	)		
	quietly replace `varlist'=	46.14 	 if (`csko' == 	40200	 | `csko' ==	40299	)		
	quietly replace `varlist'=	50.18 	 if (`csko' == 	40201	)				
	quietly replace `varlist'=	46.95 	 if (`csko' >= 	40202	 & `csko' <	40205	)		
	quietly replace `varlist'=	37.53 	 if (`csko' == 	40205	)				
	quietly replace `varlist'=	51.08 	 if (`csko' == 	40206	)				
	quietly replace `varlist'=	45.49 	 if (`csko' == 	40207	)				
	quietly replace `varlist'=	40.12 	 if (`csko' == 	40300	 | `csko' ==	40399	)		
	quietly replace `varlist'=	39.52 	 if (`csko' == 	40301	)				
	quietly replace `varlist'=	40.29 	 if (`csko' == 	40302	)				
	quietly replace `varlist'=	53.58 	 if (`csko' >= 	40400	 & `csko' <	40500	)		
	quietly replace `varlist'=	57.43 	 if (`csko' == 	40500	 | `csko' ==	40599	)		
	quietly replace `varlist'=	56.12 	 if (`csko' == 	40501	)				
	quietly replace `varlist'=	62.66 	 if (`csko' >= 	40502	 & `csko' <	40504	)		
	quietly replace `varlist'=	56.72 	 if (`csko' == 	40504	)				
	quietly replace `varlist'=	52.54 	 if (`csko' >= 	40505	 & `csko' <	40599	)		
	quietly replace `varlist'=	56.61 	 if (`csko' >= 	40600	 & `csko' <	40700	)		
	quietly replace `varlist'=	52.65 	 if (`csko' == 	40700	 | `csko' ==	40799	)		
	quietly replace `varlist'=	51.23 	 if (`csko' >= 	40701	 & `csko' <	40704	)		
	quietly replace `varlist'=	54.15 	 if (`csko' >= 	40704	 & `csko' <	40799	)		
	quietly replace `varlist'=	52.81 	 if (`csko' >= 	40800	 & `csko' <	40900	)		
	quietly replace `varlist'=	37.77 	 if (`csko' >= 	40900	 & `csko' <	41000	)		
	quietly replace `varlist'=	41.16 	 if (`csko' == 	41000	 | `csko' ==	41099	)		
	quietly replace `varlist'=	41.51 	 if (`csko' == 	41001	)				
	quietly replace `varlist'=	42.28 	 if (`csko' == 	41002	)				
	quietly replace `varlist'=	40.76 	 if (`csko' >= 	41003	 & `csko' <	41099	)		
	quietly replace `varlist'=	52.66 	 if (`csko' >= 	41100	 & `csko' <	41200	)		
	quietly replace `varlist'=	43.98 	 if (`csko' == 	41200	 | `csko' ==	41299	)		
	quietly replace `varlist'=	43.29 	 if (`csko' >= 	41201	 & `csko' <	41203	)		
	quietly replace `varlist'=	45.71 	 if (`csko' >= 	41203	 & `csko' <	41299	)		
	quietly replace `varlist'=	61.12 	 if (`csko' >= 	41300	 & `csko' <	41400	)		
	quietly replace `varlist'=	50.49 	 if (`csko' >= 	41400	 & `csko' <	41500	)		
	quietly replace `varlist'=	25.85 	 if (`csko' == 	50000	 | `csko' ==	59900	)		
	quietly replace `varlist'=	25.60 	 if (`csko' >= 	50100	 & `csko' <	50200	)		
	quietly replace `varlist'=	29.55 	 if (`csko' == 	50200	 | `csko' ==	50299	)		
	quietly replace `varlist'=	30.51 	 if (`csko' >= 	50201	 & `csko' <	50204	)		
	quietly replace `varlist'=	25.74 	 if (`csko' == 	50204	)				
	quietly replace `varlist'=	28.48 	 if (`csko' >= 	50300	 & `csko' <	50400	)		
	quietly replace `varlist'=	33.43 	 if (`csko' == 	50400	 | `csko' ==	50499	)		
	quietly replace `varlist'=	38.06 	 if (`csko' >= 	50401	 & `csko' <	50403	)		
	quietly replace `varlist'=	30.86 	 if (`csko' == 	50403	)				
	quietly replace `varlist'=	38.19 	 if (`csko' >= 	50500	 & `csko' <	59900	)		
	quietly replace `varlist'=	39.73 	 if (`csko' == 	60000	 | `csko' ==	69900	)		
	quietly replace `varlist'=	38.40 	 if (`csko' >= 	60100	 & `csko' <	60200	)		
	quietly replace `varlist'=	36.06 	 if (`csko' == 	60200	 | `csko' ==	60299	)		
	quietly replace `varlist'=	37.03 	 if (`csko' >= 	60201	 & `csko' <	60206	)		
	quietly replace `varlist'=	34.08 	 if (`csko' == 	60206	)				
	quietly replace `varlist'=	45.62 	 if (`csko' >= 	60300	 & `csko' <	60400	)		
	quietly replace `varlist'=	31.26 	 if (`csko' >= 	60400	 & `csko' <	60500	)		
	quietly replace `varlist'=	29.44 	 if (`csko' == 	60500	 | `csko' ==	60599	)		
	quietly replace `varlist'=	27.03 	 if (`csko' == 	60501	)				
	quietly replace `varlist'=	34.82 	 if (`csko' >= 	60502	 & `csko' <	60504	)		
	quietly replace `varlist'=	27.43 	 if (`csko' == 	60504	)				
	quietly replace `varlist'=	38.30 	 if (`csko' == 	60600	 | `csko' ==	60699	)		
	quietly replace `varlist'=	38.59 	 if (`csko' >= 	60601	 & `csko' <	60603	)		
	quietly replace `varlist'=	44.45 	 if (`csko' == 	60603	)				
	quietly replace `varlist'=	37.11 	 if (`csko' == 	60604	)				
	quietly replace `varlist'=	36.22 	 if (`csko' >= 	60700	 & `csko' <	60800	)		
	quietly replace `varlist'=	42.57 	 if (`csko' >= 	60800	 & `csko' <	60900	)		
	quietly replace `varlist'=	28.27 	 if (`csko' >= 	60900	 & `csko' <	61000	)		
	quietly replace `varlist'=	52.02 	 if (`csko' >= 	61000	 & `csko' <	61100	)		
	quietly replace `varlist'=	44.20 	 if (`csko' >= 	61100	 & `csko' <	61200	)		
	quietly replace `varlist'=	37.80 	 if (`csko' >= 	61200	 & `csko' <	61300	)		
	quietly replace `varlist'=	36.23 	 if (`csko' >= 	61300	 & `csko' <	61500	)		
	quietly replace `varlist'=	39.33 	 if (`csko' == 	61500	 | `csko' ==	61599	)		
	quietly replace `varlist'=	43.40 	 if (`csko' == 	61501	)				
	quietly replace `varlist'=	41.12 	 if (`csko' == 	61502	)				
	quietly replace `varlist'=	35.28 	 if (`csko' >= 	61503	 & `csko' <	61599	)		
	quietly replace `varlist'=	44.25 	 if (`csko' >= 	61600	 & `csko' <	61700	)		
	quietly replace `varlist'=	46.91 	 if (`csko' >= 	61700	 & `csko' <	61800	)		
	quietly replace `varlist'=	42.65 	 if (`csko' == 	61800	 | `csko' ==	61899	)		
	quietly replace `varlist'=	41.52 	 if (`csko' >= 	61801	 & `csko' <	61803	)		
	quietly replace `varlist'=	49.75 	 if (`csko' >= 	61803	 & `csko' <	61899	)		
	quietly replace `varlist'=	39.45 	 if (`csko' >= 	61900	 & `csko' <	62000	)		
	quietly replace `varlist'=	44.48 	 if (`csko' == 	62000	 | `csko' ==	62099	)		
	quietly replace `varlist'=	44.20 	 if (`csko' >= 	62001	 & `csko' <	62003	)		
	quietly replace `varlist'=	44.83 	 if (`csko' >= 	62003	 & `csko' <	62099	)		
	quietly replace `varlist'=	45.51 	 if (`csko' >= 	62100	 & `csko' <	62200	)		
	quietly replace `varlist'=	44.48 	 if (`csko' >= 	62200	 & `csko' <	62300	)		
	quietly replace `varlist'=	47.37 	 if (`csko' >= 	62300	 & `csko' <	62400	)		
	quietly replace `varlist'=	32.00 	 if (`csko' >= 	62400	 & `csko' <	62500	)		
	quietly replace `varlist'=	39.60 	 if (`csko' >= 	62500	 & `csko' <	62600	)		
	quietly replace `varlist'=	39.59 	 if (`csko' >= 	62600	 & `csko' <	62700	)		
	quietly replace `varlist'=	48.68 	 if (`csko' >= 	62700	 & `csko' <	62900	)		
	quietly replace `varlist'=	40.46 	 if (`csko' == 	62900	 | `csko' ==	62999	)		
	quietly replace `varlist'=	37.82 	 if (`csko' == 	62901	)				
	quietly replace `varlist'=	41.69 	 if (`csko' == 	62902	)				
	quietly replace `varlist'=	44.05 	 if (`csko' == 	62903	)				
	quietly replace `varlist'=	40.83 	 if (`csko' >= 	62904	 & `csko' <	62999	)		
	quietly replace `varlist'=	43.97 	 if (`csko' == 	63000	 | `csko' ==	63099	)		
	quietly replace `varlist'=	46.89 	 if (`csko' == 	63001	)				
	quietly replace `varlist'=	46.77 	 if (`csko' == 	63002	)				
	quietly replace `varlist'=	43.94 	 if (`csko' >= 	63003	 & `csko' <	63005	)		
	quietly replace `varlist'=	42.19 	 if (`csko' == 	63005	)				
	quietly replace `varlist'=	42.83 	 if (`csko' == 	63100	 | `csko' ==	63199	)		
	quietly replace `varlist'=	50.18 	 if (`csko' >= 	63101	 & `csko' <	63103	)		
	quietly replace `varlist'=	46.82 	 if (`csko' >= 	63103	 & `csko' <	63105	)		
	quietly replace `varlist'=	32.13 	 if (`csko' >= 	63105	 & `csko' <	63199	)		
	quietly replace `varlist'=	.	 if (`csko' >= 	70000	)
	
end

